{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5.1 Optimizing A Data Set for Memory Usage"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>8/6/93</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>3/31/96</td>\n",
       "      <td>61933.0</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaN</td>\n",
       "      <td>130590.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jerry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3/4/05</td>\n",
       "      <td>138705.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1/24/98</td>\n",
       "      <td>101004.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>Phillip</td>\n",
       "      <td>Male</td>\n",
       "      <td>1/31/84</td>\n",
       "      <td>42392.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>Russell</td>\n",
       "      <td>Male</td>\n",
       "      <td>5/20/13</td>\n",
       "      <td>96914.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>4/20/13</td>\n",
       "      <td>60500.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>Albert</td>\n",
       "      <td>Male</td>\n",
       "      <td>5/15/12</td>\n",
       "      <td>129949.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1000</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1001 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     First Name  Gender Start Date    Salary   Mgmt          Team\n",
       "0       Douglas    Male     8/6/93       NaN   True     Marketing\n",
       "1        Thomas    Male    3/31/96   61933.0   True           NaN\n",
       "2         Maria  Female        NaN  130590.0  False       Finance\n",
       "3         Jerry     NaN     3/4/05  138705.0   True       Finance\n",
       "4         Larry    Male    1/24/98  101004.0   True            IT\n",
       "...         ...     ...        ...       ...    ...           ...\n",
       "996     Phillip    Male    1/31/84   42392.0  False       Finance\n",
       "997     Russell    Male    5/20/13   96914.0  False       Product\n",
       "998       Larry    Male    4/20/13   60500.0  False  Business Dev\n",
       "999      Albert    Male    5/15/12  129949.0   True         Sales\n",
       "1000        NaN     NaN        NaN       NaN    NaN           NaN\n",
       "\n",
       "[1001 rows x 6 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.read_csv(\"employees.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933.0</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaT</td>\n",
       "      <td>130590.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jerry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2005-03-04</td>\n",
       "      <td>138705.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  First Name  Gender Start Date    Salary   Mgmt       Team\n",
       "0    Douglas    Male 1993-08-06       NaN   True  Marketing\n",
       "1     Thomas    Male 1996-03-31   61933.0   True        NaN\n",
       "2      Maria  Female        NaT  130590.0  False    Finance\n",
       "3      Jerry     NaN 2005-03-04  138705.0   True    Finance\n",
       "4      Larry    Male 1998-01-24  101004.0   True         IT"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.read_csv(\"employees.csv\", parse_dates = [\"Start Date\"]).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "employees = pd.read_csv(\n",
    "    \"employees.csv\", parse_dates = [\"Start Date\"]\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1001 entries, 0 to 1000\n",
      "Data columns (total 6 columns):\n",
      " #   Column      Non-Null Count  Dtype         \n",
      "---  ------      --------------  -----         \n",
      " 0   First Name  933 non-null    object        \n",
      " 1   Gender      854 non-null    object        \n",
      " 2   Start Date  999 non-null    datetime64[ns]\n",
      " 3   Salary      999 non-null    float64       \n",
      " 4   Mgmt        933 non-null    object        \n",
      " 5   Team        957 non-null    object        \n",
      "dtypes: datetime64[ns](1), float64(1), object(4)\n",
      "memory usage: 47.0+ KB\n"
     ]
    }
   ],
   "source": [
    "employees.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.1.1 Converting Data Types with the astype Method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0        True\n",
       "1        True\n",
       "2       False\n",
       "3        True\n",
       "4        True\n",
       "        ...  \n",
       "996     False\n",
       "997     False\n",
       "998     False\n",
       "999      True\n",
       "1000     True\n",
       "Name: Mgmt, Length: 1001, dtype: bool"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"Mgmt\"].astype(bool)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "employees[\"Mgmt\"] = employees[\"Mgmt\"].astype(bool)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>Phillip</td>\n",
       "      <td>Male</td>\n",
       "      <td>1984-01-31</td>\n",
       "      <td>42392.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>Russell</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-05-20</td>\n",
       "      <td>96914.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-04-20</td>\n",
       "      <td>60500.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>Albert</td>\n",
       "      <td>Male</td>\n",
       "      <td>2012-05-15</td>\n",
       "      <td>129949.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1000</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaT</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     First Name Gender Start Date    Salary   Mgmt          Team\n",
       "996     Phillip   Male 1984-01-31   42392.0  False       Finance\n",
       "997     Russell   Male 2013-05-20   96914.0  False       Product\n",
       "998       Larry   Male 2013-04-20   60500.0  False  Business Dev\n",
       "999      Albert   Male 2012-05-15  129949.0   True         Sales\n",
       "1000        NaN    NaN        NaT       NaN   True           NaN"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1001 entries, 0 to 1000\n",
      "Data columns (total 6 columns):\n",
      " #   Column      Non-Null Count  Dtype         \n",
      "---  ------      --------------  -----         \n",
      " 0   First Name  933 non-null    object        \n",
      " 1   Gender      854 non-null    object        \n",
      " 2   Start Date  999 non-null    datetime64[ns]\n",
      " 3   Salary      999 non-null    float64       \n",
      " 4   Mgmt        1001 non-null   bool          \n",
      " 5   Team        957 non-null    object        \n",
      "dtypes: bool(1), datetime64[ns](1), float64(1), object(3)\n",
      "memory usage: 40.2+ KB\n"
     ]
    }
   ],
   "source": [
    "employees.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**NOTE**: I've commented out the code below so that the Notebook can run without raising an error."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "# employees[\"Salary\"].astype(int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "996      42392.0\n",
       "997      96914.0\n",
       "998      60500.0\n",
       "999     129949.0\n",
       "1000         0.0\n",
       "Name: Salary, dtype: float64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"Salary\"].fillna(0).tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "996      42392\n",
       "997      96914\n",
       "998      60500\n",
       "999     129949\n",
       "1000         0\n",
       "Name: Salary, dtype: int64"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"Salary\"].fillna(0).astype(int).tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "employees[\"Salary\"] = employees[\"Salary\"].fillna(0).astype(int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "First Name    200\n",
       "Gender          2\n",
       "Start Date    971\n",
       "Salary        995\n",
       "Mgmt            2\n",
       "Team           10\n",
       "dtype: int64"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.nunique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0         Male\n",
       "1         Male\n",
       "2       Female\n",
       "3          NaN\n",
       "4         Male\n",
       "         ...  \n",
       "996       Male\n",
       "997       Male\n",
       "998       Male\n",
       "999       Male\n",
       "1000       NaN\n",
       "Name: Gender, Length: 1001, dtype: category\n",
       "Categories (2, object): ['Female', 'Male']"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"Gender\"].astype(\"category\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "employees[\"Gender\"] = employees[\"Gender\"].astype(\"category\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1001 entries, 0 to 1000\n",
      "Data columns (total 6 columns):\n",
      " #   Column      Non-Null Count  Dtype         \n",
      "---  ------      --------------  -----         \n",
      " 0   First Name  933 non-null    object        \n",
      " 1   Gender      854 non-null    category      \n",
      " 2   Start Date  999 non-null    datetime64[ns]\n",
      " 3   Salary      1001 non-null   int64         \n",
      " 4   Mgmt        1001 non-null   bool          \n",
      " 5   Team        957 non-null    object        \n",
      "dtypes: bool(1), category(1), datetime64[ns](1), int64(1), object(2)\n",
      "memory usage: 33.5+ KB\n"
     ]
    }
   ],
   "source": [
    "employees.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "employees[\"Team\"] = employees[\"Team\"].astype(\"category\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1001 entries, 0 to 1000\n",
      "Data columns (total 6 columns):\n",
      " #   Column      Non-Null Count  Dtype         \n",
      "---  ------      --------------  -----         \n",
      " 0   First Name  933 non-null    object        \n",
      " 1   Gender      854 non-null    category      \n",
      " 2   Start Date  999 non-null    datetime64[ns]\n",
      " 3   Salary      1001 non-null   int64         \n",
      " 4   Mgmt        1001 non-null   bool          \n",
      " 5   Team        957 non-null    category      \n",
      "dtypes: bool(1), category(2), datetime64[ns](1), int64(1), object(1)\n",
      "memory usage: 27.0+ KB\n"
     ]
    }
   ],
   "source": [
    "employees.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5.2 Filtering by a Single Condition"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"Maria\" == \"Maria\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"Maria\" == \"Taylor\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       False\n",
       "1       False\n",
       "2        True\n",
       "3       False\n",
       "4       False\n",
       "        ...  \n",
       "996     False\n",
       "997     False\n",
       "998     False\n",
       "999     False\n",
       "1000    False\n",
       "Name: First Name, Length: 1001, dtype: bool"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"First Name\"] == \"Maria\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaT</td>\n",
       "      <td>130590</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>1990-12-27</td>\n",
       "      <td>36067</td>\n",
       "      <td>True</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>815</th>\n",
       "      <td>Maria</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1986-01-18</td>\n",
       "      <td>106562</td>\n",
       "      <td>False</td>\n",
       "      <td>HR</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>844</th>\n",
       "      <td>Maria</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1985-06-19</td>\n",
       "      <td>148857</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>936</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>2003-03-14</td>\n",
       "      <td>96250</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>984</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>2011-10-15</td>\n",
       "      <td>43455</td>\n",
       "      <td>False</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    First Name  Gender Start Date  Salary   Mgmt          Team\n",
       "2        Maria  Female        NaT  130590  False       Finance\n",
       "198      Maria  Female 1990-12-27   36067   True       Product\n",
       "815      Maria     NaN 1986-01-18  106562  False            HR\n",
       "844      Maria     NaN 1985-06-19  148857  False         Legal\n",
       "936      Maria  Female 2003-03-14   96250  False  Business Dev\n",
       "984      Maria  Female 2011-10-15   43455  False   Engineering"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[employees[\"First Name\"] == \"Maria\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaT</td>\n",
       "      <td>130590</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>198</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>1990-12-27</td>\n",
       "      <td>36067</td>\n",
       "      <td>True</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>815</th>\n",
       "      <td>Maria</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1986-01-18</td>\n",
       "      <td>106562</td>\n",
       "      <td>False</td>\n",
       "      <td>HR</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>844</th>\n",
       "      <td>Maria</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1985-06-19</td>\n",
       "      <td>148857</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>936</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>2003-03-14</td>\n",
       "      <td>96250</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>984</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>2011-10-15</td>\n",
       "      <td>43455</td>\n",
       "      <td>False</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    First Name  Gender Start Date  Salary   Mgmt          Team\n",
       "2        Maria  Female        NaT  130590  False       Finance\n",
       "198      Maria  Female 1990-12-27   36067   True       Product\n",
       "815      Maria     NaN 1986-01-18  106562  False            HR\n",
       "844      Maria     NaN 1985-06-19  148857  False         Legal\n",
       "936      Maria  Female 2003-03-14   96250  False  Business Dev\n",
       "984      Maria  Female 2011-10-15   43455  False   Engineering"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "marias = employees[\"First Name\"] == \"Maria\"\n",
    "employees[marias]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"Finance\" != \"Engineering\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0        True\n",
       "1        True\n",
       "2       False\n",
       "3       False\n",
       "4        True\n",
       "        ...  \n",
       "996     False\n",
       "997      True\n",
       "998      True\n",
       "999      True\n",
       "1000     True\n",
       "Name: Team, Length: 1001, dtype: bool"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"Team\"] != \"Finance\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Dennis</td>\n",
       "      <td>Male</td>\n",
       "      <td>1987-04-18</td>\n",
       "      <td>115163</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Ruby</td>\n",
       "      <td>Female</td>\n",
       "      <td>1987-08-17</td>\n",
       "      <td>65476</td>\n",
       "      <td>True</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>Henry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-11-23</td>\n",
       "      <td>132483</td>\n",
       "      <td>False</td>\n",
       "      <td>Distribution</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>Russell</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-05-20</td>\n",
       "      <td>96914</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-04-20</td>\n",
       "      <td>60500</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>Albert</td>\n",
       "      <td>Male</td>\n",
       "      <td>2012-05-15</td>\n",
       "      <td>129949</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1000</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaT</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>899 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     First Name  Gender Start Date  Salary   Mgmt          Team\n",
       "0       Douglas    Male 1993-08-06       0   True     Marketing\n",
       "1        Thomas    Male 1996-03-31   61933   True           NaN\n",
       "4         Larry    Male 1998-01-24  101004   True            IT\n",
       "5        Dennis    Male 1987-04-18  115163  False         Legal\n",
       "6          Ruby  Female 1987-08-17   65476   True       Product\n",
       "...         ...     ...        ...     ...    ...           ...\n",
       "995       Henry     NaN 2014-11-23  132483  False  Distribution\n",
       "997     Russell    Male 2013-05-20   96914  False       Product\n",
       "998       Larry    Male 2013-04-20   60500  False  Business Dev\n",
       "999      Albert    Male 2012-05-15  129949   True         Sales\n",
       "1000        NaN     NaN        NaT       0   True           NaN\n",
       "\n",
       "[899 rows x 6 columns]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[employees[\"Team\"] != \"Finance\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jerry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2005-03-04</td>\n",
       "      <td>138705</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Ruby</td>\n",
       "      <td>Female</td>\n",
       "      <td>1987-08-17</td>\n",
       "      <td>65476</td>\n",
       "      <td>True</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  First Name  Gender Start Date  Salary  Mgmt       Team\n",
       "0    Douglas    Male 1993-08-06       0  True  Marketing\n",
       "1     Thomas    Male 1996-03-31   61933  True        NaN\n",
       "3      Jerry     NaN 2005-03-04  138705  True    Finance\n",
       "4      Larry    Male 1998-01-24  101004  True         IT\n",
       "6       Ruby  Female 1987-08-17   65476  True    Product"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[employees[\"Mgmt\"]].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    False\n",
       "1    False\n",
       "2     True\n",
       "3     True\n",
       "4     True\n",
       "Name: Salary, dtype: bool"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "high_earners = employees[\"Salary\"] > 100000\n",
    "high_earners.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaT</td>\n",
       "      <td>130590</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jerry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2005-03-04</td>\n",
       "      <td>138705</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Dennis</td>\n",
       "      <td>Male</td>\n",
       "      <td>1987-04-18</td>\n",
       "      <td>115163</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Frances</td>\n",
       "      <td>Female</td>\n",
       "      <td>2002-08-08</td>\n",
       "      <td>139852</td>\n",
       "      <td>True</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  First Name  Gender Start Date  Salary   Mgmt          Team\n",
       "2      Maria  Female        NaT  130590  False       Finance\n",
       "3      Jerry     NaN 2005-03-04  138705   True       Finance\n",
       "4      Larry    Male 1998-01-24  101004   True            IT\n",
       "5     Dennis    Male 1987-04-18  115163  False         Legal\n",
       "9    Frances  Female 2002-08-08  139852   True  Business Dev"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[high_earners].head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5.3 Filtering by Multiple Conditions"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.3.1 The AND Condition"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "is_female = employees[\"Gender\"] == \"Female\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "in_biz_dev = employees[\"Team\"] == \"Business Dev\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Frances</td>\n",
       "      <td>Female</td>\n",
       "      <td>2002-08-08</td>\n",
       "      <td>139852</td>\n",
       "      <td>True</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>Jean</td>\n",
       "      <td>Female</td>\n",
       "      <td>1993-12-18</td>\n",
       "      <td>119082</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>Rachel</td>\n",
       "      <td>Female</td>\n",
       "      <td>2009-02-16</td>\n",
       "      <td>142032</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>Stephanie</td>\n",
       "      <td>Female</td>\n",
       "      <td>1986-09-13</td>\n",
       "      <td>36844</td>\n",
       "      <td>True</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>61</th>\n",
       "      <td>Denise</td>\n",
       "      <td>Female</td>\n",
       "      <td>2001-11-06</td>\n",
       "      <td>106862</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   First Name  Gender Start Date  Salary   Mgmt          Team\n",
       "9     Frances  Female 2002-08-08  139852   True  Business Dev\n",
       "33       Jean  Female 1993-12-18  119082  False  Business Dev\n",
       "36     Rachel  Female 2009-02-16  142032  False  Business Dev\n",
       "38  Stephanie  Female 1986-09-13   36844   True  Business Dev\n",
       "61     Denise  Female 2001-11-06  106862  False  Business Dev"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[is_female & in_biz_dev].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Frances</td>\n",
       "      <td>Female</td>\n",
       "      <td>2002-08-08</td>\n",
       "      <td>139852</td>\n",
       "      <td>True</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>Stephanie</td>\n",
       "      <td>Female</td>\n",
       "      <td>1986-09-13</td>\n",
       "      <td>36844</td>\n",
       "      <td>True</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>66</th>\n",
       "      <td>Nancy</td>\n",
       "      <td>Female</td>\n",
       "      <td>2012-12-15</td>\n",
       "      <td>125250</td>\n",
       "      <td>True</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>92</th>\n",
       "      <td>Linda</td>\n",
       "      <td>Female</td>\n",
       "      <td>2000-05-25</td>\n",
       "      <td>119009</td>\n",
       "      <td>True</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>111</th>\n",
       "      <td>Bonnie</td>\n",
       "      <td>Female</td>\n",
       "      <td>1999-12-17</td>\n",
       "      <td>42153</td>\n",
       "      <td>True</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    First Name  Gender Start Date  Salary  Mgmt          Team\n",
       "9      Frances  Female 2002-08-08  139852  True  Business Dev\n",
       "38   Stephanie  Female 1986-09-13   36844  True  Business Dev\n",
       "66       Nancy  Female 2012-12-15  125250  True  Business Dev\n",
       "92       Linda  Female 2000-05-25  119009  True  Business Dev\n",
       "111     Bonnie  Female 1999-12-17   42153  True  Business Dev"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "is_manager = employees[\"Mgmt\"]\n",
    "employees[is_female & in_biz_dev & is_manager].head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.3.2 The OR Condition"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "earning_below_40k = employees[\"Salary\"] < 40000\n",
    "started_after_2015 = employees[\"Start Date\"] > \"2015-01-01\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>958</th>\n",
       "      <td>Gloria</td>\n",
       "      <td>Female</td>\n",
       "      <td>1987-10-24</td>\n",
       "      <td>39833</td>\n",
       "      <td>False</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>964</th>\n",
       "      <td>Bruce</td>\n",
       "      <td>Male</td>\n",
       "      <td>1980-05-07</td>\n",
       "      <td>35802</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>967</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>2016-03-12</td>\n",
       "      <td>105681</td>\n",
       "      <td>False</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>989</th>\n",
       "      <td>Justin</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1991-02-10</td>\n",
       "      <td>38344</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1000</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaT</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     First Name  Gender Start Date  Salary   Mgmt         Team\n",
       "958      Gloria  Female 1987-10-24   39833  False  Engineering\n",
       "964       Bruce    Male 1980-05-07   35802   True        Sales\n",
       "967      Thomas    Male 2016-03-12  105681  False  Engineering\n",
       "989      Justin     NaN 1991-02-10   38344  False        Legal\n",
       "1000        NaN     NaN        NaT       0   True          NaN"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[earning_below_40k | started_after_2015].tail()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.3.3 Inversion with ~"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0     True\n",
       "1    False\n",
       "2     True\n",
       "dtype: bool"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "my_series = pd.Series([True, False, True])\n",
    "my_series"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    False\n",
       "1     True\n",
       "2    False\n",
       "dtype: bool"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "~my_series"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Ruby</td>\n",
       "      <td>Female</td>\n",
       "      <td>1987-08-17</td>\n",
       "      <td>65476</td>\n",
       "      <td>True</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>NaN</td>\n",
       "      <td>Female</td>\n",
       "      <td>2015-07-20</td>\n",
       "      <td>45906</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Angela</td>\n",
       "      <td>Female</td>\n",
       "      <td>2005-11-22</td>\n",
       "      <td>95570</td>\n",
       "      <td>True</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  First Name  Gender Start Date  Salary  Mgmt         Team\n",
       "0    Douglas    Male 1993-08-06       0  True    Marketing\n",
       "1     Thomas    Male 1996-03-31   61933  True          NaN\n",
       "6       Ruby  Female 1987-08-17   65476  True      Product\n",
       "7        NaN  Female 2015-07-20   45906  True      Finance\n",
       "8     Angela  Female 2005-11-22   95570  True  Engineering"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[employees[\"Salary\"] < 100000].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Ruby</td>\n",
       "      <td>Female</td>\n",
       "      <td>1987-08-17</td>\n",
       "      <td>65476</td>\n",
       "      <td>True</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>NaN</td>\n",
       "      <td>Female</td>\n",
       "      <td>2015-07-20</td>\n",
       "      <td>45906</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Angela</td>\n",
       "      <td>Female</td>\n",
       "      <td>2005-11-22</td>\n",
       "      <td>95570</td>\n",
       "      <td>True</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  First Name  Gender Start Date  Salary  Mgmt         Team\n",
       "0    Douglas    Male 1993-08-06       0  True    Marketing\n",
       "1     Thomas    Male 1996-03-31   61933  True          NaN\n",
       "6       Ruby  Female 1987-08-17   65476  True      Product\n",
       "7        NaN  Female 2015-07-20   45906  True      Finance\n",
       "8     Angela  Female 2005-11-22   95570  True  Engineering"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[~(employees[\"Salary\"] >= 100000)].head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.3.4 Methods for Booleans"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5.4 Filtering by Condition"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.4.1 The isin Method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Dennis</td>\n",
       "      <td>Male</td>\n",
       "      <td>1987-04-18</td>\n",
       "      <td>115163</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Julie</td>\n",
       "      <td>Female</td>\n",
       "      <td>1997-10-26</td>\n",
       "      <td>102508</td>\n",
       "      <td>True</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Gary</td>\n",
       "      <td>Male</td>\n",
       "      <td>2008-01-27</td>\n",
       "      <td>109831</td>\n",
       "      <td>False</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Lois</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1995-04-22</td>\n",
       "      <td>64714</td>\n",
       "      <td>True</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   First Name  Gender Start Date  Salary   Mgmt       Team\n",
       "0     Douglas    Male 1993-08-06       0   True  Marketing\n",
       "5      Dennis    Male 1987-04-18  115163  False      Legal\n",
       "11      Julie  Female 1997-10-26  102508   True      Legal\n",
       "13       Gary    Male 2008-01-27  109831  False      Sales\n",
       "20       Lois     NaN 1995-04-22   64714   True      Legal"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sales = employees[\"Team\"] == \"Sales\"\n",
    "legal = employees[\"Team\"] == \"Legal\"\n",
    "mktg  = employees[\"Team\"] == \"Marketing\"\n",
    "employees[sales | legal | mktg].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Dennis</td>\n",
       "      <td>Male</td>\n",
       "      <td>1987-04-18</td>\n",
       "      <td>115163</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Julie</td>\n",
       "      <td>Female</td>\n",
       "      <td>1997-10-26</td>\n",
       "      <td>102508</td>\n",
       "      <td>True</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Gary</td>\n",
       "      <td>Male</td>\n",
       "      <td>2008-01-27</td>\n",
       "      <td>109831</td>\n",
       "      <td>False</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Lois</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1995-04-22</td>\n",
       "      <td>64714</td>\n",
       "      <td>True</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   First Name  Gender Start Date  Salary   Mgmt       Team\n",
       "0     Douglas    Male 1993-08-06       0   True  Marketing\n",
       "5      Dennis    Male 1987-04-18  115163  False      Legal\n",
       "11      Julie  Female 1997-10-26  102508   True      Legal\n",
       "13       Gary    Male 2008-01-27  109831  False      Sales\n",
       "20       Lois     NaN 1995-04-22   64714   True      Legal"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "all_star_teams = [\"Sales\", \"Legal\", \"Marketing\"]\n",
    "on_all_star_teams = employees[\"Team\"].isin(all_star_teams)\n",
    "employees[on_all_star_teams].head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.4.2 The between Method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Donna</td>\n",
       "      <td>Female</td>\n",
       "      <td>2010-07-22</td>\n",
       "      <td>81014</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>Joyce</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2005-02-20</td>\n",
       "      <td>88657</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>Theresa</td>\n",
       "      <td>Female</td>\n",
       "      <td>2006-10-10</td>\n",
       "      <td>85182</td>\n",
       "      <td>False</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>Roger</td>\n",
       "      <td>Male</td>\n",
       "      <td>1980-04-17</td>\n",
       "      <td>88010</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>Sara</td>\n",
       "      <td>Female</td>\n",
       "      <td>2007-08-15</td>\n",
       "      <td>83677</td>\n",
       "      <td>False</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   First Name  Gender Start Date  Salary   Mgmt         Team\n",
       "19      Donna  Female 2010-07-22   81014  False      Product\n",
       "31      Joyce     NaN 2005-02-20   88657  False      Product\n",
       "35    Theresa  Female 2006-10-10   85182  False        Sales\n",
       "45      Roger    Male 1980-04-17   88010   True        Sales\n",
       "54       Sara  Female 2007-08-15   83677  False  Engineering"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "higher_than_80 = employees[\"Salary\"] >= 80000\n",
    "lower_than_90 = employees[\"Salary\"] < 90000\n",
    "employees[higher_than_80 & lower_than_90].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>Donna</td>\n",
       "      <td>Female</td>\n",
       "      <td>2010-07-22</td>\n",
       "      <td>81014</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>Joyce</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2005-02-20</td>\n",
       "      <td>88657</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>Theresa</td>\n",
       "      <td>Female</td>\n",
       "      <td>2006-10-10</td>\n",
       "      <td>85182</td>\n",
       "      <td>False</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>Roger</td>\n",
       "      <td>Male</td>\n",
       "      <td>1980-04-17</td>\n",
       "      <td>88010</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>Sara</td>\n",
       "      <td>Female</td>\n",
       "      <td>2007-08-15</td>\n",
       "      <td>83677</td>\n",
       "      <td>False</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   First Name  Gender Start Date  Salary   Mgmt         Team\n",
       "19      Donna  Female 2010-07-22   81014  False      Product\n",
       "31      Joyce     NaN 2005-02-20   88657  False      Product\n",
       "35    Theresa  Female 2006-10-10   85182  False        Sales\n",
       "45      Roger    Male 1980-04-17   88010   True        Sales\n",
       "54       Sara  Female 2007-08-15   83677  False  Engineering"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "between_80k_and_90k = employees[\"Salary\"].between(80000, 90000)\n",
    "employees[between_80k_and_90k].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Dennis</td>\n",
       "      <td>Male</td>\n",
       "      <td>1987-04-18</td>\n",
       "      <td>115163</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Ruby</td>\n",
       "      <td>Female</td>\n",
       "      <td>1987-08-17</td>\n",
       "      <td>65476</td>\n",
       "      <td>True</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Louise</td>\n",
       "      <td>Female</td>\n",
       "      <td>1980-08-12</td>\n",
       "      <td>63241</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Brandon</td>\n",
       "      <td>Male</td>\n",
       "      <td>1980-12-01</td>\n",
       "      <td>112807</td>\n",
       "      <td>True</td>\n",
       "      <td>HR</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Shawn</td>\n",
       "      <td>Male</td>\n",
       "      <td>1986-12-07</td>\n",
       "      <td>111737</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   First Name  Gender Start Date  Salary   Mgmt     Team\n",
       "5      Dennis    Male 1987-04-18  115163  False    Legal\n",
       "6        Ruby  Female 1987-08-17   65476   True  Product\n",
       "10     Louise  Female 1980-08-12   63241   True      NaN\n",
       "12    Brandon    Male 1980-12-01  112807   True       HR\n",
       "17      Shawn    Male 1986-12-07  111737  False  Product"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eighties_folk = employees[\"Start Date\"].between(\n",
    "    left = \"1980-01-01\",\n",
    "    right = \"1990-01-01\"\n",
    ")\n",
    "\n",
    "employees[eighties_folk].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Ruby</td>\n",
       "      <td>Female</td>\n",
       "      <td>1987-08-17</td>\n",
       "      <td>65476</td>\n",
       "      <td>True</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>Rachel</td>\n",
       "      <td>Female</td>\n",
       "      <td>2009-02-16</td>\n",
       "      <td>142032</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>Roger</td>\n",
       "      <td>Male</td>\n",
       "      <td>1980-04-17</td>\n",
       "      <td>88010</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>67</th>\n",
       "      <td>Rachel</td>\n",
       "      <td>Female</td>\n",
       "      <td>1999-08-16</td>\n",
       "      <td>51178</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>Robin</td>\n",
       "      <td>Female</td>\n",
       "      <td>1983-06-04</td>\n",
       "      <td>114797</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   First Name  Gender Start Date  Salary   Mgmt          Team\n",
       "6        Ruby  Female 1987-08-17   65476   True       Product\n",
       "36     Rachel  Female 2009-02-16  142032  False  Business Dev\n",
       "45      Roger    Male 1980-04-17   88010   True         Sales\n",
       "67     Rachel  Female 1999-08-16   51178   True       Finance\n",
       "78      Robin  Female 1983-06-04  114797   True         Sales"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_starts_with_r = employees[\"First Name\"].between(\"R\", \"S\")\n",
    "employees[name_starts_with_r].head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.4.3 The isnull and notnull Methods"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaT</td>\n",
       "      <td>130590</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jerry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2005-03-04</td>\n",
       "      <td>138705</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  First Name  Gender Start Date  Salary   Mgmt       Team\n",
       "0    Douglas    Male 1993-08-06       0   True  Marketing\n",
       "1     Thomas    Male 1996-03-31   61933   True        NaN\n",
       "2      Maria  Female        NaT  130590  False    Finance\n",
       "3      Jerry     NaN 2005-03-04  138705   True    Finance\n",
       "4      Larry    Male 1998-01-24  101004   True         IT"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    False\n",
       "1     True\n",
       "2    False\n",
       "3    False\n",
       "4    False\n",
       "Name: Team, dtype: bool"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"Team\"].isnull().head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    False\n",
       "1    False\n",
       "2     True\n",
       "3    False\n",
       "4    False\n",
       "Name: Start Date, dtype: bool"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"Start Date\"].isnull().head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0     True\n",
       "1    False\n",
       "2     True\n",
       "3     True\n",
       "4     True\n",
       "Name: Team, dtype: bool"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"Team\"].notnull().head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0     True\n",
       "1    False\n",
       "2     True\n",
       "3     True\n",
       "4     True\n",
       "Name: Team, dtype: bool"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(~employees[\"Team\"].isnull()).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Louise</td>\n",
       "      <td>Female</td>\n",
       "      <td>1980-08-12</td>\n",
       "      <td>63241</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>NaN</td>\n",
       "      <td>Male</td>\n",
       "      <td>2012-06-14</td>\n",
       "      <td>125792</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>NaN</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-08-21</td>\n",
       "      <td>122340</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>91</th>\n",
       "      <td>James</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2005-01-26</td>\n",
       "      <td>128771</td>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   First Name  Gender Start Date  Salary   Mgmt Team\n",
       "1      Thomas    Male 1996-03-31   61933   True  NaN\n",
       "10     Louise  Female 1980-08-12   63241   True  NaN\n",
       "23        NaN    Male 2012-06-14  125792   True  NaN\n",
       "32        NaN    Male 1998-08-21  122340   True  NaN\n",
       "91      James     NaN 2005-01-26  128771  False  NaN"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "no_team = employees[\"Team\"].isnull()\n",
    "employees[no_team].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>Henry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-11-23</td>\n",
       "      <td>132483</td>\n",
       "      <td>False</td>\n",
       "      <td>Distribution</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>Phillip</td>\n",
       "      <td>Male</td>\n",
       "      <td>1984-01-31</td>\n",
       "      <td>42392</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>Russell</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-05-20</td>\n",
       "      <td>96914</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-04-20</td>\n",
       "      <td>60500</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>Albert</td>\n",
       "      <td>Male</td>\n",
       "      <td>2012-05-15</td>\n",
       "      <td>129949</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    First Name Gender Start Date  Salary   Mgmt          Team\n",
       "995      Henry    NaN 2014-11-23  132483  False  Distribution\n",
       "996    Phillip   Male 1984-01-31   42392  False       Finance\n",
       "997    Russell   Male 2013-05-20   96914  False       Product\n",
       "998      Larry   Male 2013-04-20   60500  False  Business Dev\n",
       "999     Albert   Male 2012-05-15  129949   True         Sales"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "has_name = employees[\"First Name\"].notnull()\n",
    "employees[has_name].tail()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.4.4 Dealing with Null Values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "employees = pd.read_csv(\n",
    "    \"employees.csv\", parse_dates = [\"Start Date\"]\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933.0</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaT</td>\n",
       "      <td>130590.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jerry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2005-03-04</td>\n",
       "      <td>138705.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>Phillip</td>\n",
       "      <td>Male</td>\n",
       "      <td>1984-01-31</td>\n",
       "      <td>42392.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>Russell</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-05-20</td>\n",
       "      <td>96914.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-04-20</td>\n",
       "      <td>60500.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>Albert</td>\n",
       "      <td>Male</td>\n",
       "      <td>2012-05-15</td>\n",
       "      <td>129949.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1000</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaT</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1001 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     First Name  Gender Start Date    Salary   Mgmt          Team\n",
       "0       Douglas    Male 1993-08-06       NaN   True     Marketing\n",
       "1        Thomas    Male 1996-03-31   61933.0   True           NaN\n",
       "2         Maria  Female        NaT  130590.0  False       Finance\n",
       "3         Jerry     NaN 2005-03-04  138705.0   True       Finance\n",
       "4         Larry    Male 1998-01-24  101004.0   True            IT\n",
       "...         ...     ...        ...       ...    ...           ...\n",
       "996     Phillip    Male 1984-01-31   42392.0  False       Finance\n",
       "997     Russell    Male 2013-05-20   96914.0  False       Product\n",
       "998       Larry    Male 2013-04-20   60500.0  False  Business Dev\n",
       "999      Albert    Male 2012-05-15  129949.0   True         Sales\n",
       "1000        NaN     NaN        NaT       NaN    NaN           NaN\n",
       "\n",
       "[1001 rows x 6 columns]"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Dennis</td>\n",
       "      <td>Male</td>\n",
       "      <td>1987-04-18</td>\n",
       "      <td>115163.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Ruby</td>\n",
       "      <td>Female</td>\n",
       "      <td>1987-08-17</td>\n",
       "      <td>65476.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Angela</td>\n",
       "      <td>Female</td>\n",
       "      <td>2005-11-22</td>\n",
       "      <td>95570.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Frances</td>\n",
       "      <td>Female</td>\n",
       "      <td>2002-08-08</td>\n",
       "      <td>139852.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>994</th>\n",
       "      <td>George</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-06-21</td>\n",
       "      <td>98874.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>Phillip</td>\n",
       "      <td>Male</td>\n",
       "      <td>1984-01-31</td>\n",
       "      <td>42392.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>Russell</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-05-20</td>\n",
       "      <td>96914.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-04-20</td>\n",
       "      <td>60500.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>Albert</td>\n",
       "      <td>Male</td>\n",
       "      <td>2012-05-15</td>\n",
       "      <td>129949.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>761 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    First Name  Gender Start Date    Salary   Mgmt          Team\n",
       "4        Larry    Male 1998-01-24  101004.0   True            IT\n",
       "5       Dennis    Male 1987-04-18  115163.0  False         Legal\n",
       "6         Ruby  Female 1987-08-17   65476.0   True       Product\n",
       "8       Angela  Female 2005-11-22   95570.0   True   Engineering\n",
       "9      Frances  Female 2002-08-08  139852.0   True  Business Dev\n",
       "..         ...     ...        ...       ...    ...           ...\n",
       "994     George    Male 2013-06-21   98874.0   True     Marketing\n",
       "996    Phillip    Male 1984-01-31   42392.0  False       Finance\n",
       "997    Russell    Male 2013-05-20   96914.0  False       Product\n",
       "998      Larry    Male 2013-04-20   60500.0  False  Business Dev\n",
       "999     Albert    Male 2012-05-15  129949.0   True         Sales\n",
       "\n",
       "[761 rows x 6 columns]"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.dropna()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>Henry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-11-23</td>\n",
       "      <td>132483.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Distribution</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>Phillip</td>\n",
       "      <td>Male</td>\n",
       "      <td>1984-01-31</td>\n",
       "      <td>42392.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>Russell</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-05-20</td>\n",
       "      <td>96914.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-04-20</td>\n",
       "      <td>60500.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>Albert</td>\n",
       "      <td>Male</td>\n",
       "      <td>2012-05-15</td>\n",
       "      <td>129949.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    First Name Gender Start Date    Salary   Mgmt          Team\n",
       "995      Henry    NaN 2014-11-23  132483.0  False  Distribution\n",
       "996    Phillip   Male 1984-01-31   42392.0  False       Finance\n",
       "997    Russell   Male 2013-05-20   96914.0  False       Product\n",
       "998      Larry   Male 2013-04-20   60500.0  False  Business Dev\n",
       "999     Albert   Male 2012-05-15  129949.0   True         Sales"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.dropna(how = \"all\").tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>994</th>\n",
       "      <td>George</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-06-21</td>\n",
       "      <td>98874.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>Phillip</td>\n",
       "      <td>Male</td>\n",
       "      <td>1984-01-31</td>\n",
       "      <td>42392.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>Russell</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-05-20</td>\n",
       "      <td>96914.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-04-20</td>\n",
       "      <td>60500.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>Albert</td>\n",
       "      <td>Male</td>\n",
       "      <td>2012-05-15</td>\n",
       "      <td>129949.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    First Name Gender Start Date    Salary   Mgmt          Team\n",
       "994     George   Male 2013-06-21   98874.0   True     Marketing\n",
       "996    Phillip   Male 1984-01-31   42392.0  False       Finance\n",
       "997    Russell   Male 2013-05-20   96914.0  False       Product\n",
       "998      Larry   Male 2013-04-20   60500.0  False  Business Dev\n",
       "999     Albert   Male 2012-05-15  129949.0   True         Sales"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.dropna(how = \"any\").tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>994</th>\n",
       "      <td>George</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-06-21</td>\n",
       "      <td>98874.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>Phillip</td>\n",
       "      <td>Male</td>\n",
       "      <td>1984-01-31</td>\n",
       "      <td>42392.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>Russell</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-05-20</td>\n",
       "      <td>96914.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-04-20</td>\n",
       "      <td>60500.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>Albert</td>\n",
       "      <td>Male</td>\n",
       "      <td>2012-05-15</td>\n",
       "      <td>129949.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    First Name Gender Start Date    Salary   Mgmt          Team\n",
       "994     George   Male 2013-06-21   98874.0   True     Marketing\n",
       "996    Phillip   Male 1984-01-31   42392.0  False       Finance\n",
       "997    Russell   Male 2013-05-20   96914.0  False       Product\n",
       "998      Larry   Male 2013-04-20   60500.0  False  Business Dev\n",
       "999     Albert   Male 2012-05-15  129949.0   True         Sales"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.dropna(subset = [\"Gender\"]).tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933.0</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jerry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2005-03-04</td>\n",
       "      <td>138705.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Dennis</td>\n",
       "      <td>Male</td>\n",
       "      <td>1987-04-18</td>\n",
       "      <td>115163.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Ruby</td>\n",
       "      <td>Female</td>\n",
       "      <td>1987-08-17</td>\n",
       "      <td>65476.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  First Name  Gender Start Date    Salary   Mgmt     Team\n",
       "1     Thomas    Male 1996-03-31   61933.0   True      NaN\n",
       "3      Jerry     NaN 2005-03-04  138705.0   True  Finance\n",
       "4      Larry    Male 1998-01-24  101004.0   True       IT\n",
       "5     Dennis    Male 1987-04-18  115163.0  False    Legal\n",
       "6       Ruby  Female 1987-08-17   65476.0   True  Product"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.dropna(subset = [\"Start Date\", \"Salary\"]).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933.0</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaT</td>\n",
       "      <td>130590.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jerry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2005-03-04</td>\n",
       "      <td>138705.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  First Name  Gender Start Date    Salary   Mgmt       Team\n",
       "0    Douglas    Male 1993-08-06       NaN   True  Marketing\n",
       "1     Thomas    Male 1996-03-31   61933.0   True        NaN\n",
       "2      Maria  Female        NaT  130590.0  False    Finance\n",
       "3      Jerry     NaN 2005-03-04  138705.0   True    Finance\n",
       "4      Larry    Male 1998-01-24  101004.0   True         IT"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.dropna(how = \"any\", thresh = 4).head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5.5 Dealing with Duplicates"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.5.1 The duplicated Method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    Marketing\n",
       "1          NaN\n",
       "2      Finance\n",
       "3      Finance\n",
       "4           IT\n",
       "Name: Team, dtype: object"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"Team\"].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    False\n",
       "1    False\n",
       "2    False\n",
       "3     True\n",
       "4    False\n",
       "Name: Team, dtype: bool"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"Team\"].duplicated().head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    False\n",
       "1    False\n",
       "2    False\n",
       "3     True\n",
       "4    False\n",
       "Name: Team, dtype: bool"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"Team\"].duplicated(keep = \"first\").head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0        True\n",
       "1        True\n",
       "2        True\n",
       "3        True\n",
       "4        True\n",
       "        ...  \n",
       "996     False\n",
       "997     False\n",
       "998     False\n",
       "999     False\n",
       "1000    False\n",
       "Name: Team, Length: 1001, dtype: bool"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees[\"Team\"].duplicated(keep = \"last\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0     True\n",
       "1     True\n",
       "2     True\n",
       "3    False\n",
       "4     True\n",
       "Name: Team, dtype: bool"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(~employees[\"Team\"].duplicated()).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933.0</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaT</td>\n",
       "      <td>130590.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Dennis</td>\n",
       "      <td>Male</td>\n",
       "      <td>1987-04-18</td>\n",
       "      <td>115163.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Ruby</td>\n",
       "      <td>Female</td>\n",
       "      <td>1987-08-17</td>\n",
       "      <td>65476.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Angela</td>\n",
       "      <td>Female</td>\n",
       "      <td>2005-11-22</td>\n",
       "      <td>95570.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Frances</td>\n",
       "      <td>Female</td>\n",
       "      <td>2002-08-08</td>\n",
       "      <td>139852.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Brandon</td>\n",
       "      <td>Male</td>\n",
       "      <td>1980-12-01</td>\n",
       "      <td>112807.0</td>\n",
       "      <td>True</td>\n",
       "      <td>HR</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Gary</td>\n",
       "      <td>Male</td>\n",
       "      <td>2008-01-27</td>\n",
       "      <td>109831.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>Michael</td>\n",
       "      <td>Male</td>\n",
       "      <td>2008-10-10</td>\n",
       "      <td>99283.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Distribution</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   First Name  Gender Start Date    Salary   Mgmt          Team\n",
       "0     Douglas    Male 1993-08-06       NaN   True     Marketing\n",
       "1      Thomas    Male 1996-03-31   61933.0   True           NaN\n",
       "2       Maria  Female        NaT  130590.0  False       Finance\n",
       "4       Larry    Male 1998-01-24  101004.0   True            IT\n",
       "5      Dennis    Male 1987-04-18  115163.0  False         Legal\n",
       "6        Ruby  Female 1987-08-17   65476.0   True       Product\n",
       "8      Angela  Female 2005-11-22   95570.0   True   Engineering\n",
       "9     Frances  Female 2002-08-08  139852.0   True  Business Dev\n",
       "12    Brandon    Male 1980-12-01  112807.0   True            HR\n",
       "13       Gary    Male 2008-01-27  109831.0  False         Sales\n",
       "40    Michael    Male 2008-10-10   99283.0   True  Distribution"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "first_one_in_team = ~employees[\"Team\"].duplicated()\n",
    "employees[first_one_in_team]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.5.2 The drop_duplicates Method"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933.0</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaT</td>\n",
       "      <td>130590.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jerry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2005-03-04</td>\n",
       "      <td>138705.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>Phillip</td>\n",
       "      <td>Male</td>\n",
       "      <td>1984-01-31</td>\n",
       "      <td>42392.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>Russell</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-05-20</td>\n",
       "      <td>96914.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-04-20</td>\n",
       "      <td>60500.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>Albert</td>\n",
       "      <td>Male</td>\n",
       "      <td>2012-05-15</td>\n",
       "      <td>129949.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1000</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaT</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1001 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     First Name  Gender Start Date    Salary   Mgmt          Team\n",
       "0       Douglas    Male 1993-08-06       NaN   True     Marketing\n",
       "1        Thomas    Male 1996-03-31   61933.0   True           NaN\n",
       "2         Maria  Female        NaT  130590.0  False       Finance\n",
       "3         Jerry     NaN 2005-03-04  138705.0   True       Finance\n",
       "4         Larry    Male 1998-01-24  101004.0   True            IT\n",
       "...         ...     ...        ...       ...    ...           ...\n",
       "996     Phillip    Male 1984-01-31   42392.0  False       Finance\n",
       "997     Russell    Male 2013-05-20   96914.0  False       Product\n",
       "998       Larry    Male 2013-04-20   60500.0  False  Business Dev\n",
       "999      Albert    Male 2012-05-15  129949.0   True         Sales\n",
       "1000        NaN     NaN        NaT       NaN    NaN           NaN\n",
       "\n",
       "[1001 rows x 6 columns]"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.drop_duplicates()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933.0</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaT</td>\n",
       "      <td>130590.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Dennis</td>\n",
       "      <td>Male</td>\n",
       "      <td>1987-04-18</td>\n",
       "      <td>115163.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Ruby</td>\n",
       "      <td>Female</td>\n",
       "      <td>1987-08-17</td>\n",
       "      <td>65476.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Angela</td>\n",
       "      <td>Female</td>\n",
       "      <td>2005-11-22</td>\n",
       "      <td>95570.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Frances</td>\n",
       "      <td>Female</td>\n",
       "      <td>2002-08-08</td>\n",
       "      <td>139852.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Brandon</td>\n",
       "      <td>Male</td>\n",
       "      <td>1980-12-01</td>\n",
       "      <td>112807.0</td>\n",
       "      <td>True</td>\n",
       "      <td>HR</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Gary</td>\n",
       "      <td>Male</td>\n",
       "      <td>2008-01-27</td>\n",
       "      <td>109831.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>Michael</td>\n",
       "      <td>Male</td>\n",
       "      <td>2008-10-10</td>\n",
       "      <td>99283.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Distribution</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   First Name  Gender Start Date    Salary   Mgmt          Team\n",
       "0     Douglas    Male 1993-08-06       NaN   True     Marketing\n",
       "1      Thomas    Male 1996-03-31   61933.0   True           NaN\n",
       "2       Maria  Female        NaT  130590.0  False       Finance\n",
       "4       Larry    Male 1998-01-24  101004.0   True            IT\n",
       "5      Dennis    Male 1987-04-18  115163.0  False         Legal\n",
       "6        Ruby  Female 1987-08-17   65476.0   True       Product\n",
       "8      Angela  Female 2005-11-22   95570.0   True   Engineering\n",
       "9     Frances  Female 2002-08-08  139852.0   True  Business Dev\n",
       "12    Brandon    Male 1980-12-01  112807.0   True            HR\n",
       "13       Gary    Male 2008-01-27  109831.0  False         Sales\n",
       "40    Michael    Male 2008-10-10   99283.0   True  Distribution"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.drop_duplicates(subset = [\"Team\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>988</th>\n",
       "      <td>Alice</td>\n",
       "      <td>Female</td>\n",
       "      <td>2004-10-05</td>\n",
       "      <td>47638.0</td>\n",
       "      <td>False</td>\n",
       "      <td>HR</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>989</th>\n",
       "      <td>Justin</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1991-02-10</td>\n",
       "      <td>38344.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>990</th>\n",
       "      <td>Robin</td>\n",
       "      <td>Female</td>\n",
       "      <td>1987-07-24</td>\n",
       "      <td>100765.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>993</th>\n",
       "      <td>Tina</td>\n",
       "      <td>Female</td>\n",
       "      <td>1997-05-15</td>\n",
       "      <td>56450.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>994</th>\n",
       "      <td>George</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-06-21</td>\n",
       "      <td>98874.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>Henry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2014-11-23</td>\n",
       "      <td>132483.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Distribution</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>Phillip</td>\n",
       "      <td>Male</td>\n",
       "      <td>1984-01-31</td>\n",
       "      <td>42392.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>Russell</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-05-20</td>\n",
       "      <td>96914.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>2013-04-20</td>\n",
       "      <td>60500.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>Albert</td>\n",
       "      <td>Male</td>\n",
       "      <td>2012-05-15</td>\n",
       "      <td>129949.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1000</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaT</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     First Name  Gender Start Date    Salary   Mgmt          Team\n",
       "988       Alice  Female 2004-10-05   47638.0  False            HR\n",
       "989      Justin     NaN 1991-02-10   38344.0  False         Legal\n",
       "990       Robin  Female 1987-07-24  100765.0   True            IT\n",
       "993        Tina  Female 1997-05-15   56450.0   True   Engineering\n",
       "994      George    Male 2013-06-21   98874.0   True     Marketing\n",
       "995       Henry     NaN 2014-11-23  132483.0  False  Distribution\n",
       "996     Phillip    Male 1984-01-31   42392.0  False       Finance\n",
       "997     Russell    Male 2013-05-20   96914.0  False       Product\n",
       "998       Larry    Male 2013-04-20   60500.0  False  Business Dev\n",
       "999      Albert    Male 2012-05-15  129949.0   True         Sales\n",
       "1000        NaN     NaN        NaT       NaN    NaN           NaN"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.drop_duplicates(subset = [\"Team\"], keep = \"last\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Dennis</td>\n",
       "      <td>Male</td>\n",
       "      <td>1987-04-18</td>\n",
       "      <td>115163.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Angela</td>\n",
       "      <td>Female</td>\n",
       "      <td>2005-11-22</td>\n",
       "      <td>95570.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>Jean</td>\n",
       "      <td>Female</td>\n",
       "      <td>1993-12-18</td>\n",
       "      <td>119082.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Business Dev</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>190</th>\n",
       "      <td>Carol</td>\n",
       "      <td>Female</td>\n",
       "      <td>1996-03-19</td>\n",
       "      <td>57783.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>291</th>\n",
       "      <td>Tammy</td>\n",
       "      <td>Female</td>\n",
       "      <td>1984-11-11</td>\n",
       "      <td>132839.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>495</th>\n",
       "      <td>Eugene</td>\n",
       "      <td>Male</td>\n",
       "      <td>1984-05-24</td>\n",
       "      <td>81077.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Sales</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>688</th>\n",
       "      <td>Brian</td>\n",
       "      <td>Male</td>\n",
       "      <td>2007-04-07</td>\n",
       "      <td>93901.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>832</th>\n",
       "      <td>Keith</td>\n",
       "      <td>Male</td>\n",
       "      <td>2003-02-12</td>\n",
       "      <td>120672.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>887</th>\n",
       "      <td>David</td>\n",
       "      <td>Male</td>\n",
       "      <td>2009-12-05</td>\n",
       "      <td>92242.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Legal</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    First Name  Gender Start Date    Salary   Mgmt          Team\n",
       "5       Dennis    Male 1987-04-18  115163.0  False         Legal\n",
       "8       Angela  Female 2005-11-22   95570.0   True   Engineering\n",
       "33        Jean  Female 1993-12-18  119082.0  False  Business Dev\n",
       "190      Carol  Female 1996-03-19   57783.0  False       Finance\n",
       "291      Tammy  Female 1984-11-11  132839.0   True            IT\n",
       "495     Eugene    Male 1984-05-24   81077.0  False         Sales\n",
       "688      Brian    Male 2007-04-07   93901.0   True         Legal\n",
       "832      Keith    Male 2003-02-12  120672.0  False         Legal\n",
       "887      David    Male 2009-12-05   92242.0  False         Legal"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.drop_duplicates(subset = [\"First Name\"], keep = False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>217</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1999-09-03</td>\n",
       "      <td>83341.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>322</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>2002-01-08</td>\n",
       "      <td>41428.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Product</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>835</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>2007-08-04</td>\n",
       "      <td>132175.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Engineering</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    First Name Gender Start Date    Salary   Mgmt         Team\n",
       "0      Douglas   Male 1993-08-06       NaN   True    Marketing\n",
       "217    Douglas   Male 1999-09-03   83341.0   True           IT\n",
       "322    Douglas   Male 2002-01-08   41428.0  False      Product\n",
       "835    Douglas   Male 2007-08-04  132175.0  False  Engineering"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "name_is_douglas = employees[\"First Name\"] == \"Douglas\"\n",
    "is_male = employees[\"Gender\"] == \"Male\"\n",
    "employees[name_is_douglas & is_male]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>First Name</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Start Date</th>\n",
       "      <th>Salary</th>\n",
       "      <th>Mgmt</th>\n",
       "      <th>Team</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Douglas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1993-08-06</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>Marketing</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Thomas</td>\n",
       "      <td>Male</td>\n",
       "      <td>1996-03-31</td>\n",
       "      <td>61933.0</td>\n",
       "      <td>True</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Maria</td>\n",
       "      <td>Female</td>\n",
       "      <td>NaT</td>\n",
       "      <td>130590.0</td>\n",
       "      <td>False</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Jerry</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2005-03-04</td>\n",
       "      <td>138705.0</td>\n",
       "      <td>True</td>\n",
       "      <td>Finance</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Larry</td>\n",
       "      <td>Male</td>\n",
       "      <td>1998-01-24</td>\n",
       "      <td>101004.0</td>\n",
       "      <td>True</td>\n",
       "      <td>IT</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  First Name  Gender Start Date    Salary   Mgmt       Team\n",
       "0    Douglas    Male 1993-08-06       NaN   True  Marketing\n",
       "1     Thomas    Male 1996-03-31   61933.0   True        NaN\n",
       "2      Maria  Female        NaT  130590.0  False    Finance\n",
       "3      Jerry     NaN 2005-03-04  138705.0   True    Finance\n",
       "4      Larry    Male 1998-01-24  101004.0   True         IT"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "employees.drop_duplicates(subset = [\"Gender\", \"Team\"]).head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5.6 Coding Challenge"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.6.1 Problems"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 5.6.2 Solutions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>director</th>\n",
       "      <th>date_added</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Alias Grace</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3-Nov-17</td>\n",
       "      <td>TV Show</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A Patch of Fog</td>\n",
       "      <td>Michael Lennox</td>\n",
       "      <td>15-Apr-17</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Lunatics</td>\n",
       "      <td>NaN</td>\n",
       "      <td>19-Apr-19</td>\n",
       "      <td>TV Show</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Uriyadi 2</td>\n",
       "      <td>Vijay Kumar</td>\n",
       "      <td>2-Aug-19</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Shrek the Musical</td>\n",
       "      <td>Jason Moore</td>\n",
       "      <td>29-Dec-13</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5832</th>\n",
       "      <td>The Pursuit</td>\n",
       "      <td>John Papola</td>\n",
       "      <td>7-Aug-19</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5833</th>\n",
       "      <td>Hurricane Bianca</td>\n",
       "      <td>Matt Kugelman</td>\n",
       "      <td>1-Jan-17</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5834</th>\n",
       "      <td>Amar's Hands</td>\n",
       "      <td>Khaled Youssef</td>\n",
       "      <td>26-Apr-19</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5835</th>\n",
       "      <td>Bill Nye: Science Guy</td>\n",
       "      <td>Jason Sussberg</td>\n",
       "      <td>25-Apr-18</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5836</th>\n",
       "      <td>Age of Glory</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>TV Show</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5837 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                      title        director date_added     type\n",
       "0               Alias Grace             NaN   3-Nov-17  TV Show\n",
       "1            A Patch of Fog  Michael Lennox  15-Apr-17    Movie\n",
       "2                  Lunatics             NaN  19-Apr-19  TV Show\n",
       "3                 Uriyadi 2     Vijay Kumar   2-Aug-19    Movie\n",
       "4         Shrek the Musical     Jason Moore  29-Dec-13    Movie\n",
       "...                     ...             ...        ...      ...\n",
       "5832            The Pursuit     John Papola   7-Aug-19    Movie\n",
       "5833       Hurricane Bianca   Matt Kugelman   1-Jan-17    Movie\n",
       "5834           Amar's Hands  Khaled Youssef  26-Apr-19    Movie\n",
       "5835  Bill Nye: Science Guy  Jason Sussberg  25-Apr-18    Movie\n",
       "5836           Age of Glory             NaN        NaN  TV Show\n",
       "\n",
       "[5837 rows x 4 columns]"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.read_csv(\"netflix.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [],
   "source": [
    "netflix = pd.read_csv(\"netflix.csv\", parse_dates = [\"date_added\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 5837 entries, 0 to 5836\n",
      "Data columns (total 4 columns):\n",
      " #   Column      Non-Null Count  Dtype         \n",
      "---  ------      --------------  -----         \n",
      " 0   title       5837 non-null   object        \n",
      " 1   director    3936 non-null   object        \n",
      " 2   date_added  5195 non-null   datetime64[ns]\n",
      " 3   type        5837 non-null   object        \n",
      "dtypes: datetime64[ns](1), object(3)\n",
      "memory usage: 182.5+ KB\n"
     ]
    }
   ],
   "source": [
    "netflix.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "title         5780\n",
       "director      3024\n",
       "date_added    1092\n",
       "type             2\n",
       "dtype: int64"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "netflix.nunique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [],
   "source": [
    "netflix[\"type\"] = netflix[\"type\"].astype(\"category\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 5837 entries, 0 to 5836\n",
      "Data columns (total 4 columns):\n",
      " #   Column      Non-Null Count  Dtype         \n",
      "---  ------      --------------  -----         \n",
      " 0   title       5837 non-null   object        \n",
      " 1   director    3936 non-null   object        \n",
      " 2   date_added  5195 non-null   datetime64[ns]\n",
      " 3   type        5837 non-null   category      \n",
      "dtypes: category(1), datetime64[ns](1), object(2)\n",
      "memory usage: 142.8+ KB\n"
     ]
    }
   ],
   "source": [
    "netflix.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>director</th>\n",
       "      <th>date_added</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1559</th>\n",
       "      <td>Limitless</td>\n",
       "      <td>Neil Burger</td>\n",
       "      <td>2019-05-16</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2564</th>\n",
       "      <td>Limitless</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-07-01</td>\n",
       "      <td>TV Show</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4579</th>\n",
       "      <td>Limitless</td>\n",
       "      <td>Vrinda Samartha</td>\n",
       "      <td>2019-10-01</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          title         director date_added     type\n",
       "1559  Limitless      Neil Burger 2019-05-16    Movie\n",
       "2564  Limitless              NaN 2016-07-01  TV Show\n",
       "4579  Limitless  Vrinda Samartha 2019-10-01    Movie"
      ]
     },
     "execution_count": 80,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "netflix[netflix[\"title\"] == \"Limitless\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>director</th>\n",
       "      <th>date_added</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1384</th>\n",
       "      <td>Spy Kids: All the Time in the World</td>\n",
       "      <td>Robert Rodriguez</td>\n",
       "      <td>2019-02-19</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1416</th>\n",
       "      <td>Spy Kids 3: Game Over</td>\n",
       "      <td>Robert Rodriguez</td>\n",
       "      <td>2019-04-01</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1460</th>\n",
       "      <td>Spy Kids 2: The Island of Lost Dreams</td>\n",
       "      <td>Robert Rodriguez</td>\n",
       "      <td>2019-03-08</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2890</th>\n",
       "      <td>Sin City</td>\n",
       "      <td>Robert Rodriguez</td>\n",
       "      <td>2019-10-01</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3836</th>\n",
       "      <td>Shorts</td>\n",
       "      <td>Robert Rodriguez</td>\n",
       "      <td>2019-07-01</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3883</th>\n",
       "      <td>Spy Kids</td>\n",
       "      <td>Robert Rodriguez</td>\n",
       "      <td>2019-04-01</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                      title          director date_added  \\\n",
       "1384    Spy Kids: All the Time in the World  Robert Rodriguez 2019-02-19   \n",
       "1416                  Spy Kids 3: Game Over  Robert Rodriguez 2019-04-01   \n",
       "1460  Spy Kids 2: The Island of Lost Dreams  Robert Rodriguez 2019-03-08   \n",
       "2890                               Sin City  Robert Rodriguez 2019-10-01   \n",
       "3836                                 Shorts  Robert Rodriguez 2019-07-01   \n",
       "3883                               Spy Kids  Robert Rodriguez 2019-04-01   \n",
       "\n",
       "       type  \n",
       "1384  Movie  \n",
       "1416  Movie  \n",
       "1460  Movie  \n",
       "2890  Movie  \n",
       "3836  Movie  \n",
       "3883  Movie  "
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "directed_by_robert_rodriguez = (\n",
    "    netflix[\"director\"] == \"Robert Rodriguez\"\n",
    ")\n",
    "is_movie = netflix[\"type\"] == \"Movie\"\n",
    "netflix[directed_by_robert_rodriguez & is_movie]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>director</th>\n",
       "      <th>date_added</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>611</th>\n",
       "      <td>Popeye</td>\n",
       "      <td>Robert Altman</td>\n",
       "      <td>2019-11-24</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1028</th>\n",
       "      <td>The Red Sea Diving Resort</td>\n",
       "      <td>Gideon Raff</td>\n",
       "      <td>2019-07-31</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1092</th>\n",
       "      <td>Gosford Park</td>\n",
       "      <td>Robert Altman</td>\n",
       "      <td>2019-11-01</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3473</th>\n",
       "      <td>Bangkok Love Stories: Innocence</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2019-07-31</td>\n",
       "      <td>TV Show</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5117</th>\n",
       "      <td>Ramen Shop</td>\n",
       "      <td>Eric Khoo</td>\n",
       "      <td>2019-07-31</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                title       director date_added     type\n",
       "611                            Popeye  Robert Altman 2019-11-24    Movie\n",
       "1028        The Red Sea Diving Resort    Gideon Raff 2019-07-31    Movie\n",
       "1092                     Gosford Park  Robert Altman 2019-11-01    Movie\n",
       "3473  Bangkok Love Stories: Innocence            NaN 2019-07-31  TV Show\n",
       "5117                       Ramen Shop      Eric Khoo 2019-07-31    Movie"
      ]
     },
     "execution_count": 82,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "added_on_july_31 = netflix[\"date_added\"] == \"2019-07-31\"\n",
    "directed_by_altman = netflix[\"director\"] == \"Robert Altman\"\n",
    "netflix[added_on_july_31 | directed_by_altman]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>director</th>\n",
       "      <th>date_added</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>946</th>\n",
       "      <td>The Stranger</td>\n",
       "      <td>Orson Welles</td>\n",
       "      <td>2018-07-19</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1870</th>\n",
       "      <td>The Gift</td>\n",
       "      <td>Sam Raimi</td>\n",
       "      <td>2019-11-20</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3706</th>\n",
       "      <td>Spider-Man 3</td>\n",
       "      <td>Sam Raimi</td>\n",
       "      <td>2019-11-01</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4243</th>\n",
       "      <td>Tikli and Laxmi Bomb</td>\n",
       "      <td>Aditya Kripalani</td>\n",
       "      <td>2018-08-01</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4475</th>\n",
       "      <td>The Other Side of the Wind</td>\n",
       "      <td>Orson Welles</td>\n",
       "      <td>2018-11-02</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5115</th>\n",
       "      <td>Tottaa Pataaka Item Maal</td>\n",
       "      <td>Aditya Kripalani</td>\n",
       "      <td>2019-06-25</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                           title          director date_added   type\n",
       "946                 The Stranger      Orson Welles 2018-07-19  Movie\n",
       "1870                    The Gift         Sam Raimi 2019-11-20  Movie\n",
       "3706                Spider-Man 3         Sam Raimi 2019-11-01  Movie\n",
       "4243        Tikli and Laxmi Bomb  Aditya Kripalani 2018-08-01  Movie\n",
       "4475  The Other Side of the Wind      Orson Welles 2018-11-02  Movie\n",
       "5115    Tottaa Pataaka Item Maal  Aditya Kripalani 2019-06-25  Movie"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "directors = [\"Orson Welles\", \"Aditya Kripalani\", \"Sam Raimi\"]\n",
    "target_directors = netflix[\"director\"].isin(directors)\n",
    "netflix[target_directors]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>director</th>\n",
       "      <th>date_added</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>Chopsticks</td>\n",
       "      <td>Sachin Yardi</td>\n",
       "      <td>2019-05-31</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60</th>\n",
       "      <td>Away From Home</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2019-05-08</td>\n",
       "      <td>TV Show</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>82</th>\n",
       "      <td>III Smoking Barrels</td>\n",
       "      <td>Sanjib Dey</td>\n",
       "      <td>2019-06-01</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>108</th>\n",
       "      <td>Jailbirds</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2019-05-10</td>\n",
       "      <td>TV Show</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>124</th>\n",
       "      <td>Pegasus</td>\n",
       "      <td>Han Han</td>\n",
       "      <td>2019-05-31</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   title      director date_added     type\n",
       "29            Chopsticks  Sachin Yardi 2019-05-31    Movie\n",
       "60        Away From Home           NaN 2019-05-08  TV Show\n",
       "82   III Smoking Barrels    Sanjib Dey 2019-06-01    Movie\n",
       "108            Jailbirds           NaN 2019-05-10  TV Show\n",
       "124              Pegasus       Han Han 2019-05-31    Movie"
      ]
     },
     "execution_count": 84,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "may_movies = netflix[\"date_added\"].between(\n",
    "    \"2019-05-01\", \"2019-06-01\"\n",
    ")\n",
    "\n",
    "netflix[may_movies].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>director</th>\n",
       "      <th>date_added</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A Patch of Fog</td>\n",
       "      <td>Michael Lennox</td>\n",
       "      <td>2017-04-15</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Uriyadi 2</td>\n",
       "      <td>Vijay Kumar</td>\n",
       "      <td>2019-08-02</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Shrek the Musical</td>\n",
       "      <td>Jason Moore</td>\n",
       "      <td>2013-12-29</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Schubert In Love</td>\n",
       "      <td>Lars Büchel</td>\n",
       "      <td>2018-03-01</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>We Have Always Lived in the Castle</td>\n",
       "      <td>Stacie Passon</td>\n",
       "      <td>2019-09-14</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                title        director date_added   type\n",
       "1                      A Patch of Fog  Michael Lennox 2017-04-15  Movie\n",
       "3                           Uriyadi 2     Vijay Kumar 2019-08-02  Movie\n",
       "4                   Shrek the Musical     Jason Moore 2013-12-29  Movie\n",
       "5                    Schubert In Love     Lars Büchel 2018-03-01  Movie\n",
       "6  We Have Always Lived in the Castle   Stacie Passon 2019-09-14  Movie"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "netflix.dropna(subset = [\"director\"]).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>director</th>\n",
       "      <th>date_added</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Shrek the Musical</td>\n",
       "      <td>Jason Moore</td>\n",
       "      <td>2013-12-29</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Without Gorky</td>\n",
       "      <td>Cosima Spender</td>\n",
       "      <td>2017-05-31</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>Anjelah Johnson: Not Fancy</td>\n",
       "      <td>Jay Karas</td>\n",
       "      <td>2015-10-02</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>One Last Thing</td>\n",
       "      <td>Tim Rouhana</td>\n",
       "      <td>2019-08-25</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>70</th>\n",
       "      <td>Marvel's Iron Man &amp; Hulk: Heroes United</td>\n",
       "      <td>Leo Riley</td>\n",
       "      <td>2014-02-16</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5748</th>\n",
       "      <td>Menorca</td>\n",
       "      <td>John Barnard</td>\n",
       "      <td>2017-08-27</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5749</th>\n",
       "      <td>Green Room</td>\n",
       "      <td>Jeremy Saulnier</td>\n",
       "      <td>2018-11-12</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5788</th>\n",
       "      <td>Chris Brown: Welcome to My Life</td>\n",
       "      <td>Andrew Sandler</td>\n",
       "      <td>2017-10-07</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5789</th>\n",
       "      <td>A Very Murray Christmas</td>\n",
       "      <td>Sofia Coppola</td>\n",
       "      <td>2015-12-04</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5812</th>\n",
       "      <td>Little Singham in London</td>\n",
       "      <td>Prakash Satam</td>\n",
       "      <td>2019-04-22</td>\n",
       "      <td>Movie</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>391 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                        title         director date_added  \\\n",
       "4                           Shrek the Musical      Jason Moore 2013-12-29   \n",
       "12                              Without Gorky   Cosima Spender 2017-05-31   \n",
       "30                 Anjelah Johnson: Not Fancy        Jay Karas 2015-10-02   \n",
       "38                             One Last Thing      Tim Rouhana 2019-08-25   \n",
       "70    Marvel's Iron Man & Hulk: Heroes United        Leo Riley 2014-02-16   \n",
       "...                                       ...              ...        ...   \n",
       "5748                                  Menorca     John Barnard 2017-08-27   \n",
       "5749                               Green Room  Jeremy Saulnier 2018-11-12   \n",
       "5788          Chris Brown: Welcome to My Life   Andrew Sandler 2017-10-07   \n",
       "5789                  A Very Murray Christmas    Sofia Coppola 2015-12-04   \n",
       "5812                 Little Singham in London    Prakash Satam 2019-04-22   \n",
       "\n",
       "       type  \n",
       "4     Movie  \n",
       "12    Movie  \n",
       "30    Movie  \n",
       "38    Movie  \n",
       "70    Movie  \n",
       "...     ...  \n",
       "5748  Movie  \n",
       "5749  Movie  \n",
       "5788  Movie  \n",
       "5789  Movie  \n",
       "5812  Movie  \n",
       "\n",
       "[391 rows x 4 columns]"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "netflix.drop_duplicates(subset = [\"date_added\"], keep = False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5.7 Summary"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
